﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GA.Server.Api;
using GA.Server.Configuration;
using GA.Server.Objects;
using GA.Server.ConnectionListener;
using GA.Shared.Objects;
using GA.Shared.Interfaces;

namespace GA.Server.Managers
{
    public class FacilityManagerServer : GAServer, IObjectServer
    {
        public FacilityManagerServer()
        {
        }

        public FacilityManagerServer(ServerPropertiesElementCollection properties)
            : base(properties)
        {
            if (properties == null) throw new ArgumentNullException("properties");

            mFacilities = new Dictionary<int, DatabaseFacility>();
            mFacilityTypes = new Dictionary<int, DatabaseFacilityType>();
            mProjects = new Dictionary<int, DatabaseProject>();
            mProjectTypes = new Dictionary<int, DatabaseProjectType>();
        }

        public override void RegisterServer(GAServer newServer)
        {
            if (newServer is ConnectionListenerServer)
            {
                ((ConnectionListenerServer)newServer).RegisterObjectServer<Facility>(this);
                ((ConnectionListenerServer)newServer).RegisterObjectServer<FacilityType>(this);
                ((ConnectionListenerServer)newServer).RegisterObjectServer<Project>(this);
                ((ConnectionListenerServer)newServer).RegisterObjectServer<ProjectType>(this);
            }
        }

        private Dictionary<int, DatabaseFacility> mFacilities;
        private Dictionary<int, DatabaseFacilityType> mFacilityTypes;
        private Dictionary<int, DatabaseProject> mProjects;
        private Dictionary<int, DatabaseProjectType> mProjectTypes;



        #region IObjectServer Members

        public SerializableTransferObject CreateObject(SerializableTransferObject authorizedUser, SerializableTransferObject newObject)
        {
            #warning Not Implemented
            throw new NotImplementedException();
        }

        public void EditObject(SerializableTransferObject authorizedUser, SerializableTransferObject editObject)
        {
            #warning Not Implemented
        }

        public void DeleteObject(SerializableTransferObject authorizedUser, SerializableTransferObject deleteObject)
        {
            #warning Not Implemented
        }

        public SerializableTransferObject GetObject(SerializableTransferObject authorizedUser, string type, Dictionary<string, object> parameters)
        {
            #warning Not Implemented
            throw new NotImplementedException();
        }

        public IEnumerable<SerializableTransferObject> GetObjects(SerializableTransferObject authorizedUser, string type, Dictionary<string, object> parameters)
        {
            #warning Not Implemented
            throw new NotImplementedException();
        }

        #endregion
    }
}
